﻿using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EP.Core.Data
{
    public interface IRepository<TEntity> where TEntity : class
    {
        DbContext DbContext { get; }
        DbSet<TEntity> Entities { get; }
        IQueryable<TEntity> Table { get; }
        TEntity GetById(object id);
        ValueTask<TEntity> GetByIdAsync(object id);
        void Insert(TEntity entity, bool isSave = true);
        Task InsertAsync(TEntity entity, bool isSave = true);
        void Update(TEntity entity, bool isSave = true);
        Task UpdateAsync(TEntity entity, bool isSave = true);
        void Delete(TEntity entity, bool isSave = true);
        Task DeleteAsync(TEntity entity, bool isSave = true);
        int SaveChanges();
        Task<int> SaveChangesAsync();
    }
}
